package com.haizhi.crm.sys.auth.service.impl;

import com.haizhi.crm.common.constant.SysStatus;
import com.haizhi.crm.common.exception.UnexpectedStatusException;
import com.haizhi.crm.common.log.GLog;
import com.haizhi.crm.common.log.LogFactory;
import com.haizhi.crm.common.model.Response;
import com.haizhi.crm.sys.auth.dao.RelationDao;
import com.haizhi.crm.sys.auth.service.RelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by yangyijun on 2018/5/22.
 */
@Service
public class RelationServiceImpl implements RelationService {
    private static final GLog LOG = LogFactory.getLogger(RelationServiceImpl.class);

    @Autowired
    private RelationDao relationDao;

    @Override
    public Response findAll() {
        try {
            return Response.success(relationDao.list());
        } catch (Exception e) {
            LOG.error("search relation list error", e);
            throw new UnexpectedStatusException(SysStatus.FIND_RELATION_LIST_ERROR, e);
        }
    }
}
